﻿#include <XanaduCore/XTernary.h>


// constructor
XTernary::XTernary() noexcept
{
	this->_memberType = kNull;
}

// constructor
XTernary::XTernary(Type _Type) noexcept
{
	this->_memberType = _Type;
}

// constructor
XTernary::XTernary(bool _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
}

// constructor
XTernary::XTernary(char _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
}

// constructor
XTernary::XTernary(unsigned char _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
}

// constructor
XTernary::XTernary(short _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
}

// constructor
XTernary::XTernary(unsigned short _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
}

// constructor
XTernary::XTernary(int _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
}

// constructor
XTernary::XTernary(unsigned int _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
}

// constructor
XTernary::XTernary(long _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
}

// constructor
XTernary::XTernary(unsigned long _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
}

// constructor
XTernary::XTernary(long long _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
}

// constructor
XTernary::XTernary(unsigned long long _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
}

// constructor
XTernary::XTernary(const void* _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
}

// constructor
XTernary::XTernary(const XTernary& _Other) noexcept
{
	this->_memberType = _Other._memberType;
}

// constructor
XTernary::XTernary(XTernary&& _Other) noexcept
{
	if(this != &_Other)
	{
		this->_memberType = _Other._memberType;
		_Other._memberType = kNull;
	}
}

// Virtual destructor
XTernary::~XTernary() noexcept
{
	this->_memberType = kNull;
}



// [opt] operators overload =
XTernary& XTernary::operator = (Type _Type) noexcept
{
	this->_memberType = _Type;
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (bool _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (char _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (unsigned char _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (short _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (unsigned short _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (int _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (unsigned int _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (long _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (unsigned long _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (long long _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (unsigned long long _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (const void* _Value) noexcept
{
	this->_memberType = XTernary::convert(_Value);
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (const XTernary& _Other) noexcept
{
	this->_memberType = _Other._memberType;
	return *this;
}

// Operator overload =
XTernary& XTernary::operator = (XTernary&& _Other) noexcept
{
	if(this != &_Other)
	{
		this->_memberType = _Other._memberType;
		_Other._memberType = kNull;
	}
	return *this;
}




// [opt] operators overload ==
bool XTernary::operator == (Type _Type) const noexcept
{
	return this->_memberType == _Type;
}

// [opt] operators overload ==
bool XTernary::operator == (bool _Value) const noexcept
{
	return this->_memberType == XTernary::convert(_Value);
}

// [opt] operators overload ==
bool XTernary::operator == (char _Value) const noexcept
{
	return this->_memberType == XTernary::convert(_Value);
}

// [opt] operators overload ==
bool XTernary::operator == (unsigned char _Value) const noexcept
{
	return this->_memberType == XTernary::convert(_Value);
}

// [opt] operators overload ==
bool XTernary::operator == (short _Value) const noexcept
{
	return this->_memberType == XTernary::convert(_Value);
}

// [opt] operators overload ==
bool XTernary::operator == (unsigned short _Value) const noexcept
{
	return this->_memberType == XTernary::convert(_Value);
}

// [opt] operators overload ==
bool XTernary::operator == (int _Value) const noexcept
{
	return this->_memberType == XTernary::convert(_Value);
}

// [opt] operators overload ==
bool XTernary::operator == (unsigned int _Value) const noexcept
{
	return this->_memberType == XTernary::convert(_Value);
}

// [opt] operators overload ==
bool XTernary::operator == (long _Value) const noexcept
{
	return this->_memberType == XTernary::convert(_Value);
}

// [opt] operators overload ==
bool XTernary::operator == (unsigned long _Value) const noexcept
{
	return this->_memberType == XTernary::convert(_Value);
}

// [opt] operators overload ==
bool XTernary::operator == (long long _Value) const noexcept
{
	return this->_memberType == XTernary::convert(_Value);
}

// [opt] operators overload ==
bool XTernary::operator == (unsigned long long _Value) const noexcept
{
	return this->_memberType == XTernary::convert(_Value);
}

// [opt] operators overload ==
bool XTernary::operator == (const void* _Value) const noexcept
{
	return this->_memberType == XTernary::convert(_Value);
}

// [opt] operators overload ==
bool XTernary::operator == (const XTernary& _Other) const noexcept
{
	return this->_memberType == _Other._memberType;
}



// [opt] operators overload !=
bool XTernary::operator != (Type _Type) const noexcept
{
	return this->_memberType != _Type;
}

// [opt] operators overload !=
bool XTernary::operator != (bool _Value) const noexcept
{
	return this->_memberType != XTernary::convert(_Value);
}

// [opt] operators overload !=
bool XTernary::operator != (char _Value) const noexcept
{
	return this->_memberType != XTernary::convert(_Value);
}

// [opt] operators overload !=
bool XTernary::operator != (unsigned char _Value) const noexcept
{
	return this->_memberType != XTernary::convert(_Value);
}

// [opt] operators overload !=
bool XTernary::operator != (short _Value) const noexcept
{
	return this->_memberType != XTernary::convert(_Value);
}

// [opt] operators overload !=
bool XTernary::operator != (unsigned short _Value) const noexcept
{
	return this->_memberType != XTernary::convert(_Value);
}

// [opt] operators overload !=
bool XTernary::operator != (int _Value) const noexcept
{
	return this->_memberType != XTernary::convert(_Value);
}

// [opt] operators overload !=
bool XTernary::operator != (unsigned int _Value) const noexcept
{
	return this->_memberType != XTernary::convert(_Value);
}

// [opt] operators overload !=
bool XTernary::operator != (long _Value) const noexcept
{
	return this->_memberType != XTernary::convert(_Value);
}

// [opt] operators overload !=
bool XTernary::operator != (unsigned long _Value) const noexcept
{
	return this->_memberType != XTernary::convert(_Value);
}

// [opt] operators overload !=
bool XTernary::operator != (long long _Value) const noexcept
{
	return this->_memberType != XTernary::convert(_Value);
}

// [opt] operators overload !=
bool XTernary::operator != (unsigned long long _Value) const noexcept
{
	return this->_memberType != XTernary::convert(_Value);
}

// [opt] operators overload !=
bool XTernary::operator != (const void* _Value) const noexcept
{
	return this->_memberType != XTernary::convert(_Value);
}

// [opt] operators overload !=
bool XTernary::operator != (const XTernary& _Other) const noexcept
{
	return this->_memberType != _Other._memberType;
}



// [opt] convert parameter to ternary type
XTernary::Type XTernary::convert(bool _Value) noexcept
{
	return _Value ? kTrue : kFalse;
}

// [opt] convert parameter to ternary type
XTernary::Type XTernary::convert(char _Value) noexcept
{
	return XTernary::convert(static_cast<long long>(_Value));
}

// [opt] convert parameter to ternary type
XTernary::Type XTernary::convert(unsigned char _Value) noexcept
{
	return XTernary::convert(static_cast<unsigned long long>(_Value));
}

// [opt] convert parameter to ternary type
XTernary::Type XTernary::convert(short _Value) noexcept
{
	return XTernary::convert(static_cast<long long>(_Value));
}

// [opt] convert parameter to ternary type
XTernary::Type XTernary::convert(unsigned short _Value) noexcept
{
	return XTernary::convert(static_cast<unsigned long long>(_Value));
}

// [opt] convert parameter to ternary type
XTernary::Type XTernary::convert(int _Value) noexcept
{
	return XTernary::convert(static_cast<long long>(_Value));
}

// [opt] convert parameter to ternary type
XTernary::Type XTernary::convert(unsigned int _Value) noexcept
{
	return XTernary::convert(static_cast<unsigned long long>(_Value));
}

// [opt] convert parameter to ternary type
XTernary::Type XTernary::convert(long _Value) noexcept
{
	return XTernary::convert(static_cast<long long>(_Value));
}

// [opt] convert parameter to ternary type
XTernary::Type XTernary::convert(unsigned long _Value) noexcept
{
	return XTernary::convert(static_cast<unsigned long long>(_Value));
}

// [opt] convert parameter to ternary type
XTernary::Type XTernary::convert(long long _Value) noexcept
{
	if(_Value == 0)
	{
		return kNull;
	}
	else if(_Value > 0)
	{
		return kTrue;
	}
	else
	{
		return kFalse;
	}
}

// [opt] convert parameter to ternary type
XTernary::Type XTernary::convert(unsigned long long _Value) noexcept
{
	if(_Value == 0)
	{
		return kNull;
	}
	else
	{
		return kTrue;
	}
}

// [opt] convert parameter to ternary type
XTernary::Type XTernary::convert(const void* _Value) noexcept
{
	if(_Value == nullptr)
	{
		return kNull;
	}
	else
	{
		return kTrue;
	}
}



// [get] type
XTernary::Type XTernary::type() const noexcept
{
	return this->_memberType;
}



// [get] Is Null
bool XTernary::isNull() const noexcept
{
	return this->_memberType == kNull;
}

// [get] Is Null
bool XTernary::isEmpty() const noexcept
{
	return this->_memberType == kNull;
}

// [get] Is Ture
bool XTernary::isTure() const noexcept
{
	return this->_memberType == kTrue;
}

// [get] Is False
bool XTernary::isFalse() const noexcept
{
	return this->_memberType == kFalse;
}
